import {useState} from 'react'
function Dog() {
    let [isBarking,setIsBarking] = useState(false)
    let [isRunning,setRunning] = useState(false)

    const handleClick = () =>{
        // DOM 编程已经一去不复返了
        setIsBarking(true);
        setRunning(true)
        setTimeout(()=>{
            setIsBarking(false)
            setRunning(false)
        },1000)
    }
    return (
        <div onClick={handleClick}>
            <div>Dog</div>
            <p>{isBarking&&'汪汪汪'}</p>
            <p>{isRunning&&'runrunrun'}</p>
        </div>
    )
}

export default Dog